<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/head.jsp"%>
</head>
<body>
 
	<table class="layui-table">
		<thead>
			<tr>
				<th>编号</th>
				<th>审查员</th>
				<th>审查结果</th>
				<th>留言</th>
				<th>时间</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
	</table>
	<div id="test1" style="text-align: right; padding-right: 30px;"></div>
	<input type="hidden" name="pageIndex" value="1">
	<input type="hidden" name="pageLimit" value="5">

	<script type="text/javascript">
	
		var id = '<%= request.getParameter("id")%>'
		
			var curr = $('input[name="pageIndex"]').val()
		
		ajax('/ReviewRecordsServlet', 'json', {
			id:id,
			action:'get',
			pageIndex:curr,
			pageLimit:5
		}, function(data){
			// 渲染
			laypage.render({
				elem : 'test1',
				count : data.count,
				layout : [ 'count', 'prev', 'page', 'next', 'refresh',
						'skip' ],
				curr : curr,
				limit : 5,
				jump : function(obj, first) {
					$('input[name="pageIndex"]').val(obj.curr)
					if (!first) {
						refresh();
					}
				}
			});
			// 显示
			var html = "";
			var tpl = $('#tradd').html();
			$.each(data.list, function(i, dom) {
				var d = {
					id : i + 1 + (curr - 1) * 5,
					editorName :dom.editorName,
					result :dom.result=='pass'?i<data.count-1?"否定":"<text style='color:red;'>通过</text>":"否定",
					message :dom.message,
					date :dom.date
				}
				html += laytpl(tpl).render(d)
			})
			$('tbody').html(html)
		})
		
	</script>
	
	<script type="text/html" id="tradd">
		<tr>
			<td>{{d.id}}</td>
			<td>{{d.editorName}}</td>
			<td>{{d.result}}</td>
			<td>{{d.message}}</td>
			<td>{{d.date}}</td>
		</tr>
</script>
</body>
</html>